﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SchoolChartPrint.aspx.cs" Inherits="Web.SchoolChartPrint" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>中考成绩分析报告</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" href="css/style_zk_web.css" rel="stylesheet" media="screen" />
    <link type="text/css" href="css/style_zk_print.css" rel="stylesheet" media="print" />
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/jquery.jeditable.mini.js"></script>
    <script type="text/javascript">
        var CurrentId = 0;
        var arrayObj = new Array();
        var strAllow = "<%=allowPrint %>";
        var arrayAllow = new Array();
        if (strAllow != "") {
            arrayAllow = strAllow.split(",");
        }
        String.prototype.getQuery = function(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = this.substr(this.indexOf("\?") + 1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        };
        Array.prototype.contains = function(obj) {
            var i = this.length;
            while (i--) {
                if (this[i] === obj) {
                    return true;
                }
            }
            return false;
        };

        function BuildData() {
            var sid = location.href.getQuery("SchoolId");
            var eid = location.href.getQuery("ExamRoomIds");
            var arr = eid.split("-");
            for (var n = 0; n < 14; n++) {
                if (arrayAllow.length > 0) {
                    if (arrayAllow.contains(n.toString())) {
                        var multiplestr = "{sid:'" + sid + "',eid:'" + eid + "',cid:'" + n + "',flag:'multiple'}";
                        arrayObj.push(multiplestr);
                    }
                }
                else {
                    var multiplestr = "{sid:'" + sid + "',eid:'" + eid + "',cid:'" + n + "',flag:'multiple'}";
                    arrayObj.push(multiplestr);
                }
            }
            for (var n = 0; n < arr.length; n++) {
                if (arrayAllow.length > 0) {
                    if (arrayAllow.contains("14")) {
                        var singlestr1 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'14',flag:'single'}";
                        arrayObj.push(singlestr1);
                    }
                    if (arrayAllow.contains("15")) {
                        var singlestr2 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'15',flag:'single'}";
                        arrayObj.push(singlestr2);
                    }
                    if (arrayAllow.contains("16")) {
                        var singlestr3 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'16',flag:'single'}";
                        arrayObj.push(singlestr3);
                    }
                    if (arrayAllow.contains("17")) {
                        var singlestr4 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'17',flag:'single'}";
                        arrayObj.push(singlestr4);
                    }
                }
                else {
                    var singlestr1 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'14',flag:'single'}";
                    arrayObj.push(singlestr1);
                    var singlestr2 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'15',flag:'single'}";
                    arrayObj.push(singlestr2);
                    var singlestr3 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'16',flag:'single'}";
                    arrayObj.push(singlestr3);
                    var singlestr4 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'17',flag:'single'}";
                    arrayObj.push(singlestr4);
                }
            }
        }
        $(function() {
            BuildData();
            ShowChart(CurrentId);

        });

        function ShowChart(aid) {
            if (aid > (arrayObj.length - 1)) {
                return;
            }
            $.ajax({
                type: "POST",
                url: "SynthesizeService.asmx/DoPrintFeedBack",
                data: arrayObj[aid],
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(message) {
                    var objData = message.d;
                    if (objData == "Over") {
                        alert("报表不存在");
                        return;
                    }
                    if (objData == "False") {
                        alert("参数错觉");
                        return;
                    }
                    if (objData == "Exception") {
                        alert("程序异常");
                        return;
                    }
                    $("#printTableList").append(objData);
                    CurrentId = CurrentId + 1;
                    ShowChart(CurrentId);
                }
            });
        }
    </script>
</head>
<body>
<form id="form1" runat="server">
<div class="zk_head">
	<h1 class="zk_name"><em>海淀区XXXX学校</em>考试成绩分析报告</h1>
  <div class="zk_sup"><h5>北京市海淀区招生考试中心</h5><em>2011年5月</em></div>
</div>
<ul class="zk_main" id="printTableList">
  
</ul>
<ul class="zk_foot">
	<li>http://www.hdpx.com.cn</li>
        <li>电话：88616965</li>
        <li>电话：88616968</li>
        <li>东校区：北京市海淀区牡丹园小区东里2号</li>
        <li>西校区：北京市海淀区远大西路29号</li>
</ul>
</form>
<script type="text/javascript">
    $('.zk_name em').editable('edittablesave.aspx', {
        type: 'textarea',
        tooltip: "单机进行编辑",
        submit: '确定',
        cancel: '取消'
    });
    var d = new Date()
    $(".zk_sup em").html(d.getFullYear().toString() + "年" + (d.getMonth()+1).toString() + "月" + d.getDate().toString() + "日");
</script>
</body>
</html>
